// Author: Domien Nowicki, Bjorn Schobben

#ifndef TEXTUREMANAGERDIALOG_H
#define TEXTUREMANAGERDIALOG_H

#include <QDialog>
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QPushButton>

#include "TextureManagerView.h"

class TextureManagerDialog: public QDialog
{
	Q_OBJECT

public:
	TextureManagerDialog(QWidget *parent=0);
	virtual ~TextureManagerDialog();

	unsigned int GetCurrentTextureIndex() const;
	const QPixmap& GetTextureThumb(unsigned int tindex) const;

	TextureManagerModel* GetTextureManagerModel();
	void SetTextureManagerModel( TextureManagerModel* model );
protected:

signals:
	void removeTexture(unsigned int tindex);
	void addTexture();
	void addSolidTexture();
	void emptyTexture();
	void changeUserColor(unsigned int tindex, const Pixel& userColor);

private slots:
	void slotAddTexture();
	void slotAddSolidTexture();
	void slotRemoveTexture();
	void slotEmptyTexture();
	//void slotAccepted();
	void slotModelUpdated();
	void slotSelectTexture();
	void slotChangeUserColor(unsigned int tindex, const Pixel& userColor);

private:
	void SetupDialog();
	void CheckButtonStates();

	unsigned int currentTextureIndex;

	QVBoxLayout *vboxLayout;
	TextureManagerView *textureManager;
	QDialogButtonBox *buttonBox;
	QPushButton *addButton, *removeButton, *emptyButton;
};

#endif //TEXTUREMANAGERDIALOG_H

